import unittest
import requests
from 其他.学习.jiekou.demo2 import Test_Login


class TestMmtLogin(unittest.TestCase):

    def test01(self):
        session = requests.session()
        # 调用自己封装的接口，获取验证码
        Test_Login.get_verify(session)
        # 调用自己封装的接口，登录
        params = {"username": "food",
                  "password": "96e79218965eb72c92a549dd5a330112",
                  "scene": "LOGIN",
                  "captcha": 1111,
                  "uuid": "8e20ddd0-ac16-11ed-9172-39cda48efa3c"}
        resp = Test_Login.login_success(session, params)
        print(resp.json())
        self.assertEqual("food", resp.json().get("username"))

    def test02(self):
        session = requests.session()
        # 调用自己封装的接口，获取验证码
        Test_Login.get_verify(session)
        # 调用自己封装的接口，登录
        params1 = {"username": "food11",
                   "password": "96e79218965eb72c92a549dd5a330112",
                   "scene": "LOGIN",
                   "captcha": 1111,
                   "uuid": "8e20ddd0-ac16-11ed-9172-39cda48efa3c"}
        resp1 = Test_Login.login_success(session, params1)
        print(resp1.json())

        self.assertEqual('107', resp1.json().get("code"))
